StoredLearningSession.Render Method

Reads a file from within the package associated with this session and writes it to a stream.

Parent Type: StoredLearningSession

Namespace: Microsoft.LearningComponents.Storage

Assembly: Microsoft.LearningComponents.Storage.dll

Syntax
C#

public override void Render (
RenderContext context

)

Parameters

context

The context within which to render the file.

Exceptions
Exception type Condition
ArgumentNullException

Thrown if context is not provided.

InvalidOperationException

Thrown if context.RelativePath or context.Response is not provided or if the caller requests to render the package manifest. Also thrown if an Execute session requests to render content when the attempt is not active or there is no current, active activity identitified in the session.

FileNotFoundException

Thrown if the file referenced in context.RelativePath cannot be found.

DirectoryNotFoundException

Thrown if the file refernced in context.RelativePath includes a directory that does not exist in the package.

Remarks

At a minimum, the caller must set the following properties in the context:

On return, the following values in context may have been set by the session: In addition, the content was rendered into the OutputStream or Response of context.

This method will not read and write content that is not contained within the package. For instance, if the entry point for an activity is an absolute URL and the caller passes it as the context.RelativePath, this method will not succeed. It also will not render the package manifest.

In an Execute session, this method may only be called when AttemptStatus is AttemptStatus.Active.

This method may cause changes to the state of the session. After calling this method and prior to disposing the object, the application should call CommitChanges to ensure changes are persisted.